<?php
    $v=0;
if(isset($_POST['sz1'])&& isset($_POST['sz1'])){
    $sz1=floatval(($_POST['sz1']));
    $sz2=floatval(($_POST['sz2']));
    $sel=$_POST['sel'];
    if($sel=='+'){
        $v=$sz1+$sz2;
    }
    elseif($sel=='-'){
        $v=$sz1-$sz2;
    }
    elseif($sel=='*'){
        $v=$sz1*$sz2;
    }
    elseif($sel=='/'){
        if($sz2==0){
            echo '除数不能为0';
        }else{
            $v=$sz1/$sz2;
        }
    }

}
?>


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <form action="" method="POST">
    <input type="text" name='sz1' >
    <select name="sel" id="">
        <option value="+" name='+'>+</option>
        <option value="-" name='-'>-</option>
        <option value="*" name='*'>*</option>
        <option value="/" name='/'>/</option>
    </select>
    <input type="text" name="sz2">
    <input type="submit" name="button" value="=">
    <input type="text" name='sz3' value="<?php echo $v; ?>">
    </form>
</body>
</html>